﻿#pragma once
#include "XyNet/Crypto/Sha.h"

namespace XyNet
{
	/// Pbkdf2摘要
	class XYNET_API Pbkdf2 : noncopyable
	{
	public:
		/// 以摘要类型初始化
		Pbkdf2(Sha::DigestType digestType = Sha::ShaDefault);

		/// 获取摘要类型
		Sha::DigestType getDigestType() const;
		/// 设置摘要类型
		void setDigestType(Sha::DigestType digestType);

		/// 获取摘要字节大小
		int getDigestByteLength() const;
		/// 获取摘要位大小
		int getDigestBitLength() const;

		/// 计算摘要
		Bytes calculateDigest(const Bytes& input, const Bytes& salt, int iterations = 10000) const;

	private:
		/// 摘要类型
		Sha::DigestType _digestType;
	};
}